<div style="width: 700px; margin-left: auto; margin-right: auto; text-align: center; border: solid 1px #dddddd; background: #eeeeee; padding: 10px">
  <form action="/image/search" method="get">
    <label for="query" style="font-weight: bold;">Search:</label>
    <%= text_field_tag 'query', params[:query], :size => '80' %>
    <%= submit_tag 'Search' %>
  </form>
</div>
<% unless @images.nil? %>
<% if !params[:query].nil? or !params[:tag].nil? %>
<div style="padding-top: 10px;">
  <% for image in @images do %>
    <div class="thumbnail-box" onclick="if (!cancelLink) document.location='<%= url_for :action => 'show', :id => image.id, :permalink => image.permalink %>'">
      <div style="position: absolute; right: 5px; float: right; padding: 2px; background: #fff; border: solid 1px #cccccc;"><%= image.rating %></div>
      <div style="width: 200px; height: 200px; margin-left: auto; margin-right: auto;" class="thumbbox">
        <%= link_to_image_lightbox image.image_file.public_filename(:large), image.image_file.public_filename(:thumb) %>
        <div class='highslide-caption' style="visibility: hidden;">
          <h3 style="display: inline;"><%= link_to clean_text(image.title), :action => 'show', :id => image.id, :permalink => image.permalink %>: </h3><%= clean_text(image.description) %>
        </div>
      </div>
      <%= link_to clean_text(image.title), {:action => 'show', :id => image.id, :permalink => image.permalink}, {:onmouseover => 'cancelLink=true', :onmouseout => 'cancelLink=false'} %><br />
      <%= image.category.name unless image.category.nil? %><br />
      <%= link_to image.user.login, {:controller => 'account', :action => 'show', :id => image.user.login}, {:onmouseover => 'cancelLink=true', :onmouseout => 'cancelLink=false'} %> <%= distance_of_time_in_words_to_now(image.created_at) %> ago
    </div>
  <% end %>
  <div class="clearer"></div>
  <div style="display: none;">
    <div id="controlbar" class="highslide-overlay controlbar">
    <a class="previous" title="Previous (left arrow key)" onclick="return hs.previous(this)" href="#"></a>
    <a class="next" title="Next (right arrow key)" onclick="return hs.next(this)" href="#"></a>
    <a class="highslide-move" title="Click and drag to move" onclick="return false" href="#"></a>
    <a class="close" title="Close" onclick="return hs.close(this)" href="#"></a>
    </div>
  </div>
</div>
<% end %>
<div style="text-align: center;">
<%= link_to('&laquo; Previous', :page => @pages.current.previous.number, :params => @query) if @pages.current.previous %>
<%= pagination_links(@pages, :params => @query) %>
<%= link_to('Next &raquo;', :page => @pages.current.next.number, :params => @query) if @pages.current.next %>
</div>
<% end %>